﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

namespace TDSServerLib{
    [XmlRoot("MachinesCollection")]
    public class MachinesContainer{
        [XmlArray("Machines"), XmlArrayItem("Machine")]
        public List<Machine> Machines = new List<Machine>();

        public static MachinesContainer Load(string path){
            var serializer = new XmlSerializer(typeof(MachinesContainer));
            using (var stream = new FileStream(path, FileMode.Open)){
                return serializer.Deserialize(stream) as MachinesContainer;
            }
        }
    }
}
